/**
 * 
 */
package com.emovimento.synchronize;

import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Path;

/**
 * Synchronizes of changes between 2 directories. Runs in background and synchronizes all changes (new files, updates, deletes, ...).
 * Synchronizes as well the directories on start, but does not delete files (i.e. when files are deleted/moved before synchronize has been
 * started they reappear (moved files at both locations).
 */
public class SynchronizeController {
  /**
   * @param args
   * @throws IOException
   */
  public static void main(String[] args) throws IOException {
    if (args.length != 2) {
      System.err.println("Usage: synchronize <source dir> <target dir>");
      System.exit( -1);
    }

    Path sourceDirectory = FileSystems.getDefault().getPath(args[0]);
    Path destinationDirectory = FileSystems.getDefault().getPath(args[1]);
    new BothDirectionsSynchronizingDirectoryWatcher(sourceDirectory, destinationDirectory);
  }

}
